home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / IP_data_structure.txt < prev    next >
Text File  |  1999-03-16  |  6KB  |  136 lines

  1. STRUCTURE OF AN IP DATA
  2.  
  3.  
  4. Here're some infos I gathered about IP data structure, and that I tried to put altogether in an array.
  5.  
  6.  0                     1                   2                   3 
  7.  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  8. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9. |Version|  IHL  |Type of service|          Total Length            |
  10. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  11. |        Identification         |Flags|     Fragment Offset     |
  12. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  13. |Time to live   |Protocol       |Header Checksum                |
  14. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  15. |                       Source Adress                           |
  16. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  17. |                  Destination Adress                           |
  18. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  19. |     Options                                   | Padding       |
  20. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  21. |                                                                |
  22. |                                                                |
  23. |                        DATA                                     |
  24.  
  25.  
  26. |                                                                |
  27. |                                                                |
  28. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  29.  
  30.  
  31. Version    : protocol version number
  32.  
  33. +++++++IHL        : length of the header, counted in 32-bits word length (min length=5 when the header doesn't contain any option)
  34.  
  35. +++++++Type of service: shows the caracterstics of the desired service, this field is composed as follow
  36.  
  37.    0     1     2     3     4     5     6     7
  38. +-----+-----+-----+-----+-----+-----+-----+-----+
  39. | PRECEDENCE      |  D  |  T  |  R  |  O  |  O  |
  40. +-----+-----+-----+-----+-----+-----+-----+-----+
  41.  
  42. 111=NetWork Control
  43. 110=InternetWork control
  44. 101= CRITIC/ECP
  45. 100=Flash Override
  46. 011=Flash
  47. 010=Immediate
  48. 001=Priority
  49. 000=Routines
  50.  
  51. Other bits meaning:
  52. D=0 normal transmission delay   D=1 shorter delay
  53. T=0 normal flow                 T=1 high flow
  54. R=0 normal reliability          R=1 high reliability
  55. Last 2 bits: dunno
  56.  
  57. +++++++Total length: total length (header + data) of the IP packet.
  58.  
  59. +++++++Identification: the identification of the packet is assigned by the source machine and is used to put all the segments back together. All the segments of a packet have the same value in this field
  60.  
  61. Flags: 3 bits
  62. bit 1: always has to be set to 0.
  63. bit 2 (DF):
  64.       if = 0 ---> the packet can be segmented
  65.       if = 1 ---> the packet can't be segmented
  66. bit 3 (MF):
  67.       if = 0 ---> it's the last segment
  68.       if = 1 ---> there're others segments
  69.       
  70. +++++++Fragment Offset: this fields specifies which part of the packet this segment belongs to. Its value is given w/ byte as unit. For the 1st segment this field is set to 0.
  71.  
  72. +++++++Time To live: this field specifies the time the packet can 'live' when it travels all over the net. This Field is decreased everytime this packet comes across a router. The packet is dropped out if the value in this field is equal to 0, and in this case a ICMP message is sent to the source machine (the traceroute command eg uses this property)
  73.  
  74. +++++++Protocol: yhis field specifies the protocol which will handle the datas of the packet. You can find all the protocols numbers usually in the file /etc/protocols if you use a unix system. This File could looks like
  75. ip    0    IP    # internet protocol, pseudo protocol number
  76. icmp    1    ICMP    # internet control message protocol
  77. igmp    2    IGMP    # internet group multicast protocol
  78. ggp    3    GGP    # gateway-gateway protocol
  79. tcp    6    TCP    # transmission control protocol
  80. pup    12    PUP    # PARC universal packet protocol
  81. udp    17    UDP    # user datagram protocol
  82. idp    22    IDP    # WhatsThis?
  83. raw    255    RAW    # RAW IP interface
  84.  
  85. +++++++header checksum: simply the header checksum as it's written. =P
  86. As certain field are modified along the packet's travel (e.g. the time to live field), this field is recomputed by every router that handles the packet. If there's an error found by the router, the packet is droped out.
  87.  
  88. +++++++Source adress: IP of the source machine
  89.  
  90. +++++++Destination adress: IP of the target machine
  91.  
  92. +++++++Options: this field is optional (ie, not present in every packet), but it MUST be handled by the IP layer of your system. Its length is variable, and there could be O to serveral options (errr…).
  93.  
  94. I dunno much about option, here's the few I know
  95. There're 2 options format:
  96.     - a single byte that specifies the option type.
  97.     - several bytes: the 1st one specifies the option type, the 2d one the total length of the option field, The others are the options datas.
  98.  
  99. Scheme of the options byte.
  100.  
  101.    0     1     2     3     4     5     6     7
  102. +-----+-----+-----+-----+-----+-----+-----+-----+
  103. | CF  | Classes   |   Option number             |
  104. +-----+-----+-----+-----+-----+-----+-----+-----+
  105.  
  106. le bit CF: specifies if the option is copied in every segments of the packet whenever the packet is segmented
  107. bit classes: here're the value, I don't really what is it all about
  108.  00: control
  109.  01: dunno
  110.  10: dunno
  111.  11: dunno.
  112.  
  113. Differents types possibles:
  114.  
  115. +------+-----------+------------------------------------------------------+
  116. | type | length    | description                                          |
  117. +------+-----------+------------------------------------------------------+ 
  118. |   0  | w/out     |end of the option list                                  |
  119. |   1  | w/out     |no operation                                          |
  120. |  130 | 11        |security                                              |
  121. |  131 | variable  |??                                                      |
  122. |  137 | variable  |??                                                      |
  123. |   7  | variable  |record of the paths along the travel                  |
  124. |  136 | 4         |Identification of the data flows                      |
  125. |  68  | variable  |???                                                      |
  126. +------+-----------+------------------------------------------------------+
  127.  
  128.  
  129. +++++++Padding: dunno
  130.  
  131. Anonymous
  132.  
  133. PS: if anyone got any info about the stuff I couldn't mention… just lemme know please.
  134.  
  135. PS bis: sorry for all the grammar and vocabulary mistakes as english isn't my native language
  136.